<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>填写相关资料</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="/static/wx/lib/sui/sm.min.css">
    <link rel="stylesheet" href="/static/wx/lib/sui/sm-extend.min.css">
    <link rel="stylesheet" href="/static/wx/css/reset.css">
    <link rel="stylesheet" href="/static/wx/css/main.css">
    <link rel="stylesheet" href="/static/wx/css/public_main.css">
</head>

<body>
    <div class="page-group">
        <div class="page page-current" id="">
            <!-- 主内容 -->
            <div class="content">
                <div class="setp-card">
                    <div class="step-box">
                        <div class="step-item selected">
                            <div class="step-item-line"><span></span></div>
                            <div class="step-item-text size-65 text-c">参与竞价</div>
                        </div>
                        <div class="step-item selected">
                            <div class="step-item-line"><span></span></div>
                            <div class="step-item-text size-65 text-c">看货信息</div>
                        </div>
                        <div class="step-item">
                            <div class="step-item-line"><span></span></div>
                            <div class="step-item-text size-65 text-c">提货信息</div>
                        </div>
                        <div class="step-item">
                            <div class="step-item-line"><span></span></div>
                            <div class="step-item-text size-65 text-c">收款信息</div>
                        </div>
                        <div class="step-item">
                            <div class="step-item-line"><span></span></div>
                            <div class="step-item-text size-65 text-c">递交委托书</div>
                        </div>
                    </div>
                </div>
                <div class="bs-box">
                    <div class="bs-box-content">
                        <div class="bs-box-inner">
                            <div class="bs-box-content-item width-link size-m">
                                <div>看货要求</div>
                                <div><input id="look_type" value="{$info.look_type}"></div>
                            </div>
                            <div class="bs-box-content-item width-link size-m border-b-none">
                                <div>看货地址</div>
                                <div><input placeholder="请选择省市区" id="address" value="{$info.province|default=''} {$info.city|default=''} {$info.town|default=''}"></div>
                            </div>
                            <div class="bs-box-content-item" style="padding: 0px;">
                                <div><input type="text" placeholder="详细门牌地址" name="address_detail" value="{$info.address_detail | default = ''}" class="size-m"></div>
                            </div>
                            <div class="bs-box-content-item">
                                <p class="size-m">联系人</p>
                                <div><input type="text" placeholder="请填写姓名" name="linkman" value="{$info.linkman | default = ''}"  class="size-m"></div>
                            </div>
                            <div class="bs-box-content-item">
                                <p class="size-m">手机号</p>
                                <div><input type="text" placeholder="请填写手机号" name="phone" value="{$info.phone | default = ''}"  class="size-m"></div>
                            </div>
                            <div class="bs-box-content-item">
                                <p class="size-m">备用联系人手机号</p>
                                <div><input type="text" placeholder="请填写手机号（选填）" name="second_phone" value="{$info.second_phone | default = ''}"  class="size-m"></div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="btn-box" style="margin-top: 1rem;">
                    <div class="flex">
                        <div class="pre-step my-btn" style="width: 47%;"><span style="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);" onclick="window.history.go(-1)">上一步</span></div>
                        <input type="hidden" value="{$info.i_id | default = ''}" id="i_id">
                        <div class="pre-step my-btn" style="width: 47%;"><span class="active" id="submit">下一步</span></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type='text/javascript' src='/static/wx/lib/sui/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/static/wx/lib/sui/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/static/wx/lib/sui/sm-extend.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/static/wx/lib/sui/sm-city-picker.min.js' charset='utf-8'></script>
    <!--<script>$.init()</script>-->

    <!--<script type='text/javascript' src="/static/wx/lib/sui/jquery.js"></script>-->
    <script>

        $('#submit').on('touchend',function(){
            var i_id = $('#i_id').val();
            var address = $('#address').val();
            var look_type = $('#look_type').val();
            var address_detail = $('input[name="address_detail"]').val();
            var linkman = $('input[name="linkman"]').val();
            var phone = $('input[name="phone"]').val();
            var second_phone = $('input[name="second_phone"]').val();
            if (address.length == 0) {
                $.alert('请选择省市区');
                return;
            }
            if (look_type.length == 0) {
                $.alert('请选择看货要求');
                return;
            }
            if (address_detail.length == 0) {
                $.alert('请填写详细门牌地址');
                return;
            }
            if (linkman.length == 0) {
                $.alert('请填写姓名');
                return;
            }
            if (phone.length == 0) {
                $.alert('请填写手机号');
                return;
            }
            $.ajax({
                url:'/wx/insurant/saveBolInfo',
                type:'post',
                dataType:'json',
                data:{
                    'look_type':look_type,
                    'address':address,
                    'address_detail':address_detail,
                    'linkman':linkman,
                    'phone':phone,
                    'second_phone':second_phone,
                    'i_id':i_id,
                    'now_status':2
                },
                success:function (data) {
                    if(data.code ==200){
                        window.location.href = '/wx/insurant/step_3?i_id='+i_id;
                    }else{
                        $.alert(data.msg);
                    }
                }
            });
        });

        var n = $('.step-box').children().length;
        $('.step-item').css('width', document.body.clientWidth / n + 'px');


        $("#look_type").picker({
            toolbarTemplate: '<header class="bar bar-nav">\
                                <button class="button button-link pull-right close-picker">确定</button>\
                                <h1 class="title">选择看货要求</h1>\
                                </header>',
            cols: [
                {
                    textAlign: 'center',
                    values: ['预约联系', '随时看货', '交保证金后看货']
                }
            ]
        });

        $("#address").cityPicker({
            toolbarTemplate: '<header class="bar bar-nav">\
                    <button class="button button-link pull-right close-picker">确定</button>\
                    <h1 class="title">选择看货地址</h1>\
                    </header>'
        });


    </script>
</body>

</html>